SELECT
 phid-- PhId--	物理主键
,itemno-- ItemNo--	物品代码
,itemname-- ItemName--	物品名称
,phid_resbs-- PhidResbs--	资源分类主键
,spec-- Spec--	规格型号
,phid_unit-- -- PhidMsunit
,positive_dev-- PositiveDev--	正差--0
,negative_dev-- NegativeDev--	负差--0
,res_attribute-- ResProp--	物料属性--1
,checktype-- CheckType--	检验方式--3
,phid_item_property_group-- PhidItemPropGrp--	事务特性组主键--'0'
,cur_orgid-- CurOrgId--	当前登录组织--'1'
,ffid-- Ffid--	计价方式(来自表prinmtd)--'7'
,spec_e-- SpecE--	规格(英文)--''
,ng_phid_bp
,ng_phid_org
,NG_PHID_UI_SCHEME
,NG_PHID_ORIGINAL
,NG_ORGID_ORIGINAL
,FFID
,NG_SV_SEARCH_KEY
,NG_SD_SEARCH_KEY
,NG_SHARE_SIGN
,ng_insert_dt
FROM itemdata
where itemname='111'



SELECT
count(*)
FROM itemdata
where 1=1
and itemname='111'
order by itemno

-- DELETE FROM itemdata WHERE itemdata.itemname = '111';

SELECT
count(*) as a
FROM 
    ps_resbase
WHERE 
    SUBSTR(phid, 1, 3) = '888';


-- DELETE FROM ps_resbase WHERE SUBSTR(phid, 1, 3) = '888'

select 
LPAD(itemdata_seq.NEXTVAL, 4, '0')
FROM 
    ps_resbase

SELECT 
    LPAD(SUBSTR(phid, 12, 4), 4, '0')
FROM 
    ps_resbase
WHERE 
    SUBSTR(phid, 1, 3) = '888'
    and TO_CHAR(SUBSTR(phid, 4, 8)) = TO_CHAR(SYSDATE, 'YYYYMMDD');



SELECT 
    LPAD(COUNT(*), 4, '0')
    ,TO_CHAR(ng_insert_dt, 'YYYYMMDD')
    ,TO_CHAR(SYSDATE, 'YYYYMMDD')
FROM 
    ps_resbase
WHERE 
    TO_CHAR(ng_insert_dt, 'YYYYMMDD') = TO_CHAR(SYSDATE, 'YYYYMMDD');




BEGIN
InsertItemDataByPhid(8570000000000032);
END;
/



-- DELETE FROM itemdata WHERE itemdata.phid = '8880282411000183';


SELECT OWNER,
       TABLE_NAME,
       COLUMN_NAME,
       DATA_TYPE,
       DATA_LENGTH,
       DATA_PRECISION,
       DATA_SCALE,
       NULLABLE
FROM ALL_TAB_COLUMNS
WHERE TABLE_NAME = 'ITEMDATA'
and COLUMN_NAME='LOTADD'
